package com.example.village.service.impl;

import com.example.village.dao.MessageDao;
import com.example.village.entity.MessageEntity;
import com.example.village.entityVO.MessageDTO;
import com.example.village.entityVO.MessageVO;
import com.example.village.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageImpl implements MessageService {

    @Autowired
    private MessageDao messageDao;

    @Override
    public List<MessageEntity> queryByNId(Integer nId) {
        return messageDao.queryByNId(nId);
    }

    @Override
    public List<MessageEntity> queryByDim(String message) {
        return messageDao.queryByDim(message);
    }

    @Override
    public List<MessageVO> queryVOByDim(MessageDTO dto) {
        return messageDao.queryVOByDim(dto);
    }

    @Override
    public Boolean insert(MessageEntity messageEntity) {
        if (messageDao.insert(messageEntity) > 0) {

            return true;
        }
        return false;
    }

    @Override
    public Boolean update(MessageEntity messageEntity) {
        return messageDao.update(messageEntity) > 0;
    }

    @Override
    public Boolean delete(Integer id) {
        return messageDao.delete(id) > 0;
    }

    @Override
    public Boolean deleteMore(List<Integer> ids) {
        if (messageDao.deleteMore(ids) > 0) {
            return true;
        }
        return false;
    }

}
